package com.wn55.hrms.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wn55.hrms.entity.Leave;
import com.wn55.hrms.entity.OverTime;
import com.wn55.hrms.mapper.LeaveMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Mr.bai~
 * @version 1.0
 * @date 2022/5/6 20:57
 */
@Service
public class LeaveService {

    @Autowired
    LeaveMapper leaveMapper;

    public PageInfo<Leave> queryLeave(Integer now, Integer size, String eName, String type) {
        PageHelper.startPage(now,size);

        List<Leave> list = leaveMapper.selectConds(eName,type);
        return new PageInfo<>(list);
    }

    public void addLeave(Leave leave) {
        leaveMapper.insertLeave(leave);
    }

    public void removeBykey(int id) {
        leaveMapper.deleteByPrimaryKey(id);
    }

    public void modifyLeave(Leave leave) {
        leaveMapper.updateByPrimaryKey(leave);
    }
}
